function findContentChildren(g: number[], s: number[]): number {
  g.sort((a, b) => a - b);
  s.sort((a, b) => a - b);
  let j = 0;
  let ans = 0;
  for (let i of g) {
    while (j < s.length && s[j] < i) j++;
    if (j < s.length) {
      ans++;
      j++;
    }
  }
  return ans;
};